﻿using B.S.Data.MES.API.Applications.QualityManagement.ExamineDesignCommand.Commands;
using B.S.Domain.BasicData.QualityManagement;
using B.S.Infratrctrue;
using B.S.Requst;
using MediatR;

namespace B.S.Data.MES.API.Applications.QualityManagement.ExamineDesignCommand.CommandHandlers
{
    public class ShowExamineProjectCommandHandler : IRequestHandler<ShowExamineProjectCommand, APIRequst<List<ExamineProject>>>
    {
        private readonly IBaseRepository<ExamineProject> _examineprojectRepository;
        public ShowExamineProjectCommandHandler(IBaseRepository<ExamineProject> examineprojectRepository)
        {
            _examineprojectRepository = examineprojectRepository;
        }
        public Task<APIRequst<List<ExamineProject>>> Handle(ShowExamineProjectCommand request, CancellationToken cancellationToken)
        {
           var list=_examineprojectRepository.GetAll();

            return Task.FromResult(new APIRequst<List<ExamineProject>>
            {
                Data=list.ToList(),
                Code = RequstCode.成功,
                Msg=RequstCode.成功.ToString()

            });

        }
    }
}
